package com.qianyu.project.service.impl;

import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.qianyu.project.entity.Budget;
import com.qianyu.project.mapper.BudgetMapper;
import com.qianyu.project.service.IBudgetService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class BudgetServiceImpl extends ServiceImpl<BudgetMapper, Budget> implements IBudgetService {

    @Autowired
    private BudgetMapper budgetMapper;

    @Override
    public String getMaxCode() {
        String code = budgetMapper.selectMaxCode();
        if(code == null){
            code = DateUtil.today().replaceAll("-", "") + "00";
        }
        return code;
    }

    @Override
    public Budget listTo(String id) {
        return budgetMapper.listTo(id);
    }
}
